package GUI;

import java.util.Vector;

import javax.swing.ListModel;
import javax.swing.event.ListDataListener;

import data.Show;

public class SonnyListModel implements ListModel
{
	Vector<ListDataListener> dataListVectors = new Vector<ListDataListener>();
	String[] showString;
	
	public SonnyListModel(Vector<Show> sVector)
	{
		int sVectorSize = sVector.size();
		String[] tempString = new String[sVectorSize];
		for(int i=0; i<sVectorSize; i++)
		{
			tempString[i] = sVector.get(i).getShowName();
		}
		showString = tempString;
	}
	
	public void add(String newShowName)
	{
		int stringSize = this.getSize();
		int newStringSize = stringSize+1;
		String[] tempString = new String[newStringSize];
		for(int i=0; i<stringSize; i++)
		{
			tempString[i] = showString[i];
		}
		tempString[stringSize] = newShowName;
		showString = tempString;
	}

	public void del(String newShowName)
	{
		/*
		int stringSize = this.getSize();
		int newStringSize = stringSize-1;
		String[] tempString = new String[newStringSize];
		
		
		
		for(int i=0; i<stringSize; i++)
		{
			if(newShowName = showString[i])
			{
				
			}
			tempString[i] = showString[i];
		}
		tempString[stringSize] = newShowName;
		showString = tempString;
		*/
	}
	@Override
	public void addListDataListener(ListDataListener ldl) 
	{
		this.dataListVectors.add(ldl);
	}

	@Override
	public Object getElementAt(int index) 
	{
		return showString[index];
	}

	@Override
	public int getSize() 
	{
		return showString.length;
	}

	@Override
	public void removeListDataListener(ListDataListener ldl) 
	{
		this.dataListVectors.remove(ldl);
	}

}
